/**
 * Project Name:dsrs-systemservice-domain
 * File Name:GroupVo.java
 * Package Name:com.bwda.dsrs.systemservice.domain.vo.group;
 * Date:2019年4月28日
 * Copyright (c) 2019, 江苏保旺达软件有限公司 All Rights Reserved.
 */
package com.bwda.dsrs.systemservice.domain.vo.group;

import com.bwda.dsrs.systemservice.domain.Constants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * 自定义组
 *
 * @author liangjianyong
 * @date 2019/4/13
 */
@Data
@ApiModel(description = "用户组,用户组名称不重复")
public class GroupVo {

    @ApiModelProperty(value = "组ID", required = true)
    private Integer id;

    @ApiModelProperty(value = "组名称")
    private String groupName;

    @ApiModelProperty(value = "管理员编号")
    private String adminUserCode;

    @ApiModelProperty(value = "管理员名称")
    private String adminUserName;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "0正常 1禁用")
    private Integer status;

    @ApiModelProperty(value = "0未删除 1已删除")
    private Integer delFlag;

    @ApiModelProperty(value = "创建人code")
    private String createUserCode;

    @ApiModelProperty(value = "创建人姓名")
    private String createUserName;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "修改人code")
    private String updateUserCode;

    @ApiModelProperty(value = "修改人姓名")
    private String updateUserName;

    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    @ApiModelProperty(value = "组内成员")
    private String userCodes;

    public List<String> getUserCodeList() {
        if (StringUtils.isBlank(userCodes)) {
            return null;
        }
        List<String> userCodeList = new ArrayList<>();
        Collections.addAll(userCodeList, userCodes.split(Constants.SPLIT));
        return userCodeList;
    }

    public Date getCreateTime() {
        if (createTime != null){
            return (Date) createTime.clone();
        }

        return null;
    }

    public void setCreateTime(Date createTime) {
        if (createTime != null){
            this.createTime = (Date) createTime.clone();
        }
    }

    public Date getUpdateTime() {
        if (updateTime != null){
            return (Date) updateTime.clone();
        }

        return null;
    }

    public void setUpdateTime(Date updateTime) {
        if (updateTime != null){
            this.updateTime = (Date) updateTime.clone();
        }
    }
}
